using System;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Widgetsphere.Core.Util;


namespace Widgetsphere.Core.DataAccess
{

	/// <summary>
	/// Wrapper class to fool the .NET XMLSerializer into calling the custom
	/// serialization methods on the SubDomain object.
	/// </summary>
	[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
	[Serializable]
	public partial class SubDomainWrapper 
	{
		protected SubDomainBase internalObject;

		/// <summary>
		/// Default constructor provided for serialization.
		/// </summary>
		public SubDomainWrapper()
		{
		}

		public SubDomainWrapper(SubDomainBase sd)
		{
			internalObject = sd;
		}

		public SubDomainBase SubDomain
		{
			get { return internalObject; }
		}

		public string SerializedSubDomain
		{
			get { return SerializeHelper.SoapSerialize(internalObject); }
			set 
			{	
				internalObject = (SubDomainBase)SerializeHelper.SoapDeserializeFromString(value); 
				internalObject.EnsureParentRowsExist();
				internalObject.EnforceConstraints = true;

			}
		}
	}


}
